package aidansmeaton.airport;

import aidansmeaton.airport.database.DatabaseHelper;
import aidansmeaton.airport.structures.Game;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class ExampleActivity extends Activity {
	
private DatabaseHelper db;
private Game game;
	
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.example_main);
        
        db = DatabaseHelper.getInstance(this);
        
        game = new Game(this);
        
        TextView tv1 = (TextView) findViewById(R.id.example_title);
        tv1.setText(game.getAirline());
        
        TextView tv2 = (TextView) findViewById(R.id.example_main);
        
        tv2.setText(game.getHubs().get(0).toString());
        
        final Button openRouteButton = (Button) findViewById(R.id.example_openroutebutton);
        openRouteButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
				Intent i = new Intent(ExampleActivity.this,OpenRouteActivity.class);
				i.putExtra("iata", game.getHubs().get(0).getIata());
				startActivity(i);
			}
        });
        
        final Button newPlaneButton = (Button) findViewById(R.id.example_newplanebutton);
        newPlaneButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
				Intent i = new Intent(ExampleActivity.this,NewPlaneActivity.class);
				startActivity(i);
			}
        });
        
    }

}
